package dongchel.vrp.ais;

import java.util.List;

import dongchel.vrp.entity.MultiObjectiveObject;
import dongchel.vrp.general.CompareObject;

public class Density {
	
	//calculate the solution distance in eclidean space
	public double calSolutionDistance(CompareObject solution, List<CompareObject> solutionList){
		double distance = 0;
		MultiObjectiveObject moo1 = solution.getValue();
		MultiObjectiveObject moo2 = null;
		for(int i=0;i<solutionList.size();i++){
			moo2 = solutionList.get(i).getValue();
			distance += moo1.distance(moo2);
		}
		return distance;
	}
	
	public double calAverageSolutionDistance(List<CompareObject> solutionList){
		double distance = 0;
		CompareObject moo1 = null;
		for(int i=0;i<solutionList.size();i++){
			moo1 = solutionList.get(i);			
			distance += calSolutionDistance(moo1, solutionList);
		}

		distance = distance/solutionList.size();
		
		return distance;
	}
	
	public void calSecondaryPopulationDensity(){
		
	}
}
